import { createRouter, createWebHashHistory } from 'vue-router'

export const constantRoutes = [
  {
    path: '/',
    name: 'AcademicList',
    component: () => import('@v/AcademicList/index.vue'),
    meta: { title: 'academicList' },
    children: [],
  },
  // ! 工具
  {
    path: '/tools',
    meta: { title: 'tools' },
    name: 'Tools',
    component: () => import('@v/Tools/index.vue'),
    children: [
      {
        path: 'apply_fertilizer', // ? 施肥计算器
        name: 'ApplyFertilizer',
        component: () => import('@v/Tools/ApplyFertilizer/index.vue'),
        meta: { title: 'applyFertilizer' },
      },
    ],
  },
]

// 新版router设置
const router = createRouter({
  history: createWebHashHistory(), // 需要从vue-router上引入
  // hash: createWebHashHistory(),
  // abstract: createMemoryHistory(),
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRoutes,
})

export default router
